#ifndef tool_movement_h
#define tool_movement_h

#import "tool.h"

#define G 9.8f

enum MOVEMENT_TYPE
{
	MOVEMENT_TYPE_NONE = 0,
	MOVEMENT_TYPE_LINEAR,
	MOVEMENT_TYPE_PARABOLA,
};

typedef struct TMVParabolaData_
{
	CGPoint start_speed; /*初始速度*/

	float height; /*高度*/
	float time; /*全程时间*/
	float half_time; /*半程时间*/
	float span; /*跨距*/

	float a;
	float b;
}
TMVParabolaData;

typedef struct TMVLinearData_
{
	CGPoint start_pos; /*起始位置*/
	CGPoint end_pos; /*最终位置*/
	float base_speed;
	bool flag_infinity; /*是:一直移动,否:停在终点*/

	CGPoint speed; /*速度*/
	float distance; /*距离*/
	float angle; /*直线与y轴的夹角,按照cocos2d*/

	float a;
	float b;
}
TMVLinearData;

bool tmvComputeParabola(TMVParabolaData *Data);
void tmvComputeParabolaPoint(TMVParabolaData *Data, float Time, CGPoint *Buf);
void tmvComputeParabolaPointByX(TMVParabolaData *Data, float X, CGPoint *Buf);
void tmvComputeParabolaPointByY(TMVParabolaData *Data, float Y, CGPoint *Buf1, CGPoint *Buf2);
float tmvComputeParabolatTangentSlope(TMVParabolaData *Data, CGPoint *Point);

bool tmvComputeLinear(TMVLinearData *Data);
void tmvComputeLinearPoint(TMVLinearData *Data, float Time, CGPoint *Buf);
void tmvComputeLinearAngle(TMVLinearData *Data);
void tmvComputeLinearSplitSpeed(TMVLinearData *LinearData);

#endif